<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/Kongshop.css" rel="stylesheet" />
		<!-- 引入样式 -->
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<!-- 引入组件 -->
		<script src="../../js/vue.min.js"></script>
		<script src="../../js/vant.min.js"></script>
		<script src="html5plus://ready"></script>
		<script src="../../js/ajax.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/listener_other.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			.com-header {
				height: 80px;
			}
			.com-title {
				z-index: 9999;
				position: fixed;
				width: 100%;
				height: 80px;
				background: #FF4443;
				color: #FAFAFA;
			}
			
			.com-title1 {
				z-index: 9999;
				position: fixed;
				margin-top: 147%;
				width: 100%;
				height: 50px;
				background: #FBFBFB;
				color: #FAFAFA;
			}
			
			.com-main {
				width: 100%;
				margin-bottom: 28%;
			}
			
			.list {
				margin-top: 2px;
			}
			
			.item1 {
				height: 90px;
				margin-top: 8px;
				background: white;
				margin-left: 4%;
				margin-top: -12%;
			}
			
			.item1 img {
				height: 96%;
				width: 86px;
				float: left;
				margin-top: 3px;
				margin-left: 8px;
			}
			
			.listName {
				margin-left: 5px;
				color: #000000;
			}
			
			.pLeft {
				width: 25%;
				height: 100%;
				float: left;
				margin-left: 3%;
			}
			
			.pcenter {
				width: 55%;
				height: 100%;
				float: left;
			}
			
			.pRight {
				width: 20%;
				float: right;
			}
			
			.com-title {
				z-index: 9999;
				position: fixed;
				width: 100%;
				height: 80px;
				background: #FF0000;
				color: #FAFAFA;
			}
			#box{
				margin-top: 54px;
				margin-left: -33px;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<header>
				<header>
					<van-nav-bar  @click-left="onClickLeft" title="我的收藏" left-text="返回" left-arrow id="a">
					</van-nav-bar>
					<van-row style="background-color: red; width: 100%; height: 60px; color: #E8E8E8;">
					</van-row>
			</header>
			<section>
				<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
					<div id="box">
						<div class="list" v-for="(pl,index) in scsp[0]">
							<div class="item1">
								<!--图片区域-->
								<div class="pLeft" @click="skipPd(pl.GoodsId)">
									<img :src="pl.GoodsImageUrl" onerror="this.src='../../img/photo.png'"  />
								</div>
								<!--文字 计数器-->
								<div class="pcenter">
									<div style="float: left;height: 50%;width:100%;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
										<span class="listName" style="margin-left:25px;" v-text="pl.GoodsName"></span>
									</div>
								</div>
								<!--价格 删除图标-->
								<div class="pRight">
									<div style="height: 50%;margin-top: -90px;">
										<small style="color: red;font-size: 15px;margin-left: 20px;">￥</small>
										<span style="color: red;font-size: 13px;"><span v-text="pl.RealPrice"></span></span>
									</div>
									<!-- <div style="float: left;height: 50%;width:100%;">
										<div style="margin-top: -52px;">
											<span style="float:right;">x&nbsp<span v-text="pl.BrowseCount"></span></span>
										</div>
									</div> -->
								</div>
							</div>
						</div>
					</div>
				</van-pull-refresh>
			</section>
			<footer>
				
			</footer>
			</div>
			<script>
				var newUser = localStorage.getItem("user"); //从localStorage里取数据(字符串格式)
				newUser = JSON.parse(newUser); //把字符串格式转换成Json格式
				key =newUser.Key;
				var vn=new Vue({
					el:"#app",
					data:{
						scsp:[],
						isLoading: false
					},
					created:function(){
						var _this = this;
						ajax({ //获取收藏商品
							url: "http://dsapi.ysd3g.com/api/MyGoodsCollectList",
							dataType: "jsonp",
							data: {
								p:1,
								key: key//当前用户收藏商品
							},
							success: function(res) {
								if (res.Error) {
									console.log(res);
								} else {
									var sp=_this.scsp.push(res.Data);
									console.log(_this.scsp[0]);
									console.log(res);
								}
							}
						});
						
					},
					methods:{
						onRefresh: function() {						
							setTimeout(() => {
								window.history.go(0);
								this.$toast('刷新成功');
								this.isLoading = false;
							}, 500);
						},
						skipPd(id) {
							console.log(id);
							var w = plus.webview.create("../home/shopxq.html", "shopxq", {}, {
								ID: id
							}); 
							w.show();
						},
						onClickLeft:function(){
							plus.webview.close(plus.webview.currentWebview(), "slide-out-left");
						}
					}
				})
			</script>
	</body>
</html>
